/*0GI1xcoeligdpMeXoHBphhVCrhxcviGrDnphTJgmfcwMg4RNPBhEzXRaezj70QBs*/
/**
 * 卡片操作列按钮
 * @param {*} props 
 * @param {*} key 
 * @param {*} text 
 * @param {*} record 
 * @param {*} index 
 */
export default function tableButtonClick(props, key, text, record, index) {
	let { tableId } = props.pageConfig;
	switch (key) {
		// 表格操作按钮
		case 'OpenCard':
			let status = props.cardTable.getStatus(tableId);
			if (status === 'browse') {
				props.cardTable.toggleRowView(tableId, record);
			} else {
				props.cardTable.openModel(tableId, 'edit', record, index);
			}
			break;
		case 'DelLine':
			props.cardTable.delRowsByIndex(tableId, index);
			break;
		case 'CopyLine':
			let newRecord = JSON.parse(JSON.stringify(record || {}));
			//复制行时需要清空表体主键及pseudocolumn
			if (newRecord.values) {
				if (newRecord.values.pk_transasset_b) {
					newRecord.values.pk_transasset_b = { value: null, display: null };
				}
				if (newRecord.values.pseudocolumn) {
					newRecord.values.pseudocolumn = { value: null };
				}
			}
			props.cardTable.insertRowsAfterIndex(tableId, newRecord, index);
			break;
		default:
			break;
	}
}

/*0GI1xcoeligdpMeXoHBphhVCrhxcviGrDnphTJgmfcwMg4RNPBhEzXRaezj70QBs*/